package com.zpark.controller;
import com.zpark.pojo.Ranking;
import com.zpark.service.ISouHuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * @author xiaoyu
 * @version 1.0 2022/9/27
 */

@RestController
public class SouHuController {

    @Autowired
    private ISouHuService souHuService;

    // 查询所有数据
    @RequestMapping("/all")
    public List<Ranking> findAll() {
        return souHuService.selectAll();
    }

    //根据 id 查询数据
    @RequestMapping("/find_id/{id}")
    public Ranking findById(@PathVariable Integer id) {
        return souHuService.selectById(id);
    }

    //根据 id 修改数据
    @RequestMapping("/update")
    public Integer change(Integer id, String fName) {
        return souHuService.updateById(id, fName);
    }

    //根据 id 删除数据
    @RequestMapping("/del")
    public Integer remove(Integer id) {
        return souHuService.deleteById(id);
    }
}
